function getArea() {
	return (this.radius * this.radius * 3.14);
}

function getCircumference() {
	var diameter = this.radius * 2;
	var circumference = diameter * 3.14;
	return circumference;
}

function Circle(radius) {
	this.radius = radius;
	this.getArea = function(){
		return (this.radius * this.radius * 3.14);
	};
	this.getCircumference = function(){
		var diameter = this.radius * 2;
		var circumference = diameter * 3.14;
		return circumference;
	};
}

function SemiCircle(radius) {
	this.name = "SemiCircle";
	this.circle = new Circle(radius);
}

var bigCircle = new Circle(100);
document.write(bigCircle.radius+"<br/>");
document.write(bigCircle.getArea()+"<br/>");
document.write(bigCircle.getCircumference()+"<br/>");
var semCir = new SemiCircle(100);
document.write("<br/>"+semCir.circle.getCircumference());



=======================================================================


function baseClass(fName){
	this.fName = fName;
}

function subClass(fName, lName){
	var bClass = new baseClass(fName);
	this.fName = bClass.fName;
	this.lName = lName;
}

var sClass = new subClass('Nanda', 'Kumar');
document.write(sClass.fName+"<br/>");
document.write(sClass.lName+"<br/>");

=======================================================================

var apple = {
    type: "macintosh",
    color: "red",
    getInfo: function () {
        return this.color + ' ' + this.type + ' apple';
    }
}

function subClass(fName, lName){
	this.apple = apple;
	this.lName = lName;
}

var sClass = new subClass('Nanda', 'Kumar');
document.write(sClass.apple.type+"<br/>");
document.write(sClass.lName+"<br/>");


=======================================================================
							this is important example

function product(name, value){
   this.name = name;
   if(value >= 1000)
      this.value = 999;
   else
      this.value = value;
}

function prod_dept(name, value, dept){
   product.call(this, name, value);
   this.dept = dept;   
}

prod_dept.prototype.toString = function() {
	return "name : "+this.name+" / value : "+this.value+" /dept : "+this.dept+" /<br/>";
};


var cheese = new prod_dept("feta", 5, "food");
var car = new prod_dept("honda", 5000, "auto");

document.write("cheese = "+cheese);
document.write("car = "+car);


===================================================================================


var apple = function() {
    this.type = "macintosh";
    this.color = 'red';
    this.getInfo = function () {
        return this.color + ' ' + this.type + ' apple';
    };
}


apple.prototype.addInfo = function(num){
	this.num = num;	
}

function bannana(size, color){
	this.size = size;
	this.color = color;
	apple.call(this);
}

/*var app = new apple();
app.addInfo(1);
document.write(app.num+"<br/>");
document.write(app.getInfo()+"<br/>");*/

var ban = new bannana();
ban.size = 35;
ban.color = 'red';
//ban.addInfo(1);
document.write(ban.color+"<br/>");
//document.write(ban.num+"<br/>");
document.write(ban.getInfo()+"<br/>");


